// @ts-ignore
import { api } from '@/utils/api';

/** 清除命名空间下所有缓存数据 POST /cache/manage/clear */
export async function cacheManageClear(
  body: BASE.AutoDtoWithCacheManageClear,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function cacheManageClear(
  body: BASE.AutoDtoWithCacheManageClear,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function cacheManageClear(
  body: BASE.AutoDtoWithCacheManageClear,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function cacheManageClear(
  body: BASE.AutoDtoWithCacheManageClear,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/cache/manage/clear`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/cache/manage/clear`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 根据key删除缓存 POST /cache/manage/delByKey */
export async function cacheManageDelByKey(
  body: BASE.AutoDtoWithCacheManageDelbykey,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function cacheManageDelByKey(
  body: BASE.AutoDtoWithCacheManageDelbykey,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function cacheManageDelByKey(
  body: BASE.AutoDtoWithCacheManageDelbykey,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function cacheManageDelByKey(
  body: BASE.AutoDtoWithCacheManageDelbykey,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/cache/manage/delByKey`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/cache/manage/delByKey`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 根据key获取value POST /cache/manage/getByKey */
export async function cacheManageGetByKey(
  body: BASE.AutoDtoWithCacheManageGetbykey,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultCacheBean>;

export async function cacheManageGetByKey(
  body: BASE.AutoDtoWithCacheManageGetbykey,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultCacheBean>>;

export async function cacheManageGetByKey(
  body: BASE.AutoDtoWithCacheManageGetbykey,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultCacheBean>;

export async function cacheManageGetByKey(
  body: BASE.AutoDtoWithCacheManageGetbykey,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultCacheBean>(`/app/cache/manage/getByKey`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultCacheBean>(`/app/cache/manage/getByKey`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 根据命名空间获取key集合 POST /cache/manage/keys */
export async function cacheManageKeys(
  body: BASE.AutoDtoWithCacheManageKeys,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultSetString>;

export async function cacheManageKeys(
  body: BASE.AutoDtoWithCacheManageKeys,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultSetString>>;

export async function cacheManageKeys(
  body: BASE.AutoDtoWithCacheManageKeys,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultSetString>;

export async function cacheManageKeys(
  body: BASE.AutoDtoWithCacheManageKeys,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultSetString>(`/app/cache/manage/keys`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultSetString>(`/app/cache/manage/keys`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取所有命名空间 POST /cache/manage/namespaces */
export async function cacheManageNamespaces(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultCollectionString>;

export async function cacheManageNamespaces(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultCollectionString>>;

export async function cacheManageNamespaces(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultCollectionString>;

export async function cacheManageNamespaces(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultCollectionString>(`/app/cache/manage/namespaces`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultCollectionString>(`/app/cache/manage/namespaces`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 设置缓存值 POST /cache/manage/set */
export async function cacheManageSet(
  body: BASE.AutoDtoWithCacheManageSet,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function cacheManageSet(
  body: BASE.AutoDtoWithCacheManageSet,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function cacheManageSet(
  body: BASE.AutoDtoWithCacheManageSet,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function cacheManageSet(
  body: BASE.AutoDtoWithCacheManageSet,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/cache/manage/set`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/cache/manage/set`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 修改缓存时间 POST /cache/manage/updateTime */
export async function cacheManageUpdateTime(
  body: BASE.AutoDtoWithCacheManageUpdatetime,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function cacheManageUpdateTime(
  body: BASE.AutoDtoWithCacheManageUpdatetime,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function cacheManageUpdateTime(
  body: BASE.AutoDtoWithCacheManageUpdatetime,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function cacheManageUpdateTime(
  body: BASE.AutoDtoWithCacheManageUpdatetime,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/cache/manage/updateTime`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/cache/manage/updateTime`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
